]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Install all properties at once
authorBilal Elmoussaoui <belmouss@redhat.com>
Tue, 14 Apr 2026 19:31:26 +0000 (21:31 +0200)
committerBilal Elmoussaoui <belmouss@redhat.com>
Wed, 15 Apr 2026 07:37:03 +0000 (09:37 +0200)
As we already use a static array of GParamSpecs, so continue using that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4176>

src/shell-tray-icon.c
src/st/st-theme.c

index c9be146edb4670ab0ac69e848ec0c6514687e197..7a0da31378b786aedf8d504e3c895660932068a3 100644 (file)
@@ -15,9 +15,13 @@ enum {
 
    PROP_PID,
    PROP_TITLE,
-   PROP_WM_CLASS
+   PROP_WM_CLASS,
+
+   N_PROPS
 };
 
+static GParamSpec *props[N_PROPS] = { NULL, };
+
 typedef struct _ShellTrayIconPrivate ShellTrayIconPrivate;
 
 struct _ShellTrayIcon
@@ -210,21 +214,19 @@ shell_tray_icon_class_init (ShellTrayIconClass *klass)
   actor_class->get_preferred_height = shell_tray_icon_get_preferred_height;
   actor_class->allocate = shell_tray_icon_allocate;
 
-  g_object_class_install_property (object_class,
-                                   PROP_PID,
-                                   g_param_spec_uint ("pid", NULL, NULL,
-                                                      0, G_MAXUINT, 0,
-                                                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class,
-                                   PROP_TITLE,
-                                   g_param_spec_string ("title", NULL, NULL,
-                                                        NULL,
-                                                        G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class,
-                                   PROP_WM_CLASS,
-                                   g_param_spec_string ("wm-class", NULL, NULL,
-                                                        NULL,
-                                                        G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+  props[PROP_PID] = g_param_spec_uint ("pid", NULL, NULL,
+                                       0, G_MAXUINT, 0,
+                                       G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  props[PROP_TITLE] = g_param_spec_string ("title", NULL, NULL,
+                                           NULL,
+                                           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  props[PROP_WM_CLASS] = g_param_spec_string ("wm-class", NULL, NULL,
+                                              NULL,
+                                              G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (object_class, N_PROPS, props);
 }
 
 static void
index 1b55015cde3b5c8e9c675a258fa333ef1ee7f2fb..7f3300e464fce782855a37873d388d08e2b5341b 100644 (file)
@@ -77,9 +77,13 @@ enum
   PROP_0,
   PROP_APPLICATION_STYLESHEET,
   PROP_THEME_STYLESHEET,
-  PROP_DEFAULT_STYLESHEET
+  PROP_DEFAULT_STYLESHEET,
+
+  N_PROPS
 };
 
+static GParamSpec *props[N_PROPS] = { NULL, };
+
 enum
 {
   STYLESHEETS_CHANGED,
@@ -131,11 +135,9 @@ st_theme_class_init (StThemeClass *klass)
    * The highest priority stylesheet, representing application-specific
    * styling; this is associated with the CSS "author" stylesheet.
    */
-  g_object_class_install_property (object_class,
-                                   PROP_APPLICATION_STYLESHEET,
-                                   g_param_spec_object ("application-stylesheet", NULL, NULL,
-                                                        G_TYPE_FILE,
-                                                        ST_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  props[PROP_APPLICATION_STYLESHEET] = g_param_spec_object ("application-stylesheet", NULL, NULL,
+                                                            G_TYPE_FILE,
+                                                            ST_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
   /**
    * StTheme:theme-stylesheet:
@@ -143,11 +145,9 @@ st_theme_class_init (StThemeClass *klass)
    * The second priority stylesheet, representing theme-specific styling;
    * this is associated with the CSS "user" stylesheet.
    */
-  g_object_class_install_property (object_class,
-                                   PROP_THEME_STYLESHEET,
-                                   g_param_spec_object ("theme-stylesheet", NULL, NULL,
-                                                        G_TYPE_FILE,
-                                                        ST_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  props[PROP_THEME_STYLESHEET] = g_param_spec_object ("theme-stylesheet", NULL, NULL,
+                                                      G_TYPE_FILE,
+                                                      ST_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
   /**
    * StTheme:default-stylesheet:
@@ -155,11 +155,11 @@ st_theme_class_init (StThemeClass *klass)
    * The lowest priority stylesheet, representing global default
    * styling; this is associated with the CSS "user agent" stylesheet.
    */
-  g_object_class_install_property (object_class,
-                                   PROP_DEFAULT_STYLESHEET,
-                                   g_param_spec_object ("default-stylesheet", NULL, NULL,
+  props[PROP_DEFAULT_STYLESHEET] = g_param_spec_object ("default-stylesheet", NULL, NULL,
                                                         G_TYPE_FILE,
-                                                        ST_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                        ST_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+
+  g_object_class_install_properties (object_class, N_PROPS, props);
 
   signals[STYLESHEETS_CHANGED] =
     g_signal_new ("custom-stylesheets-changed",